<?php
/**
* @version		$Id: view.html.php 10214 2008-04-19 08:59:04Z eddieajau $
* @package		Joomla
* @subpackage	Media
* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/


defined('_JEXEC') or die( 'Restricted access' );

jimport( 'joomla.application.component.view');

class ManagerViewconfig extends JView {

	var $table = null;
	
    function __construct() {
    	parent::__construct();
        ManagerHelper::showMenuPim("config");
        $this->table =& JTable::getInstance('Config', 'Table');	  
    }
    
    function display() {
        $mainframe = JFactory::getApplication();
        $this->setLayout('display');
        
        ManagerHelper::showToolBar('Config Management', false, false);
        						
        $limit				= $mainframe->getUserStateFromRequest( 'config.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
        $limitstart 		= $mainframe->getUserStateFromRequest( 'config.limitstart', 'limitstart', 0, 'int' );
        $filter_order		= $mainframe->getUserStateFromRequest( 'config.filter_order', 'filter_order', 'id', 'cmd' );
        $filter_order_Dir	= $mainframe->getUserStateFromRequest( 'config.filter_order_Dir', 'filter_order_Dir', ManagerHelper::ORDER_DIR, 'word' );
        
        $Model = JModel::getInstance('Config', 'ManagerModel');
        $Model->getData($total, $dbrow, $filter_order, $filter_order_Dir, $limitstart, $limit);
		
        jimport('joomla.html.pagination');
        
        $this->assign('TOTAL_ROW', $total);
		$this->assign('dbrow', $dbrow);
		$this->assign('FORM_ORDER', $filter_order);
        $this->assign('FORM_ORDER_DIR',$filter_order_Dir);
        parent::display();
    }
    
    function addForm() {		
		$mainframe = JFactory::getApplication();
		$this->setLayout('form');					
		$cid = JRequest::getVar('cid');

        if(!empty($cid)) {
			$rows = $this->table;
			$rows->load($cid[0]);	
			$this->assign('rows',$rows);
		}
		
		parent::display();
    }
}